#pragma once
#include <QDockWidget>
#include <QMainWindow>
#include <string>
#include "MainWindowBase.h"
#include "colorswatch.h"
#include "Cv.h"
namespace OCEANUI{
	class CPanelBase:
		public QWidget
	{
		Q_OBJECT
	public:
		explicit CPanelBase(const QString& panelName,QWidget* parent);
		//default copy constructor is OK
		//default operator== is OK

		virtual ~CPanelBase()
		{

		}
		virtual bool init()
		{
			dock_->setWidget(this);
			
			CMainWindowBase::gInstance().hookEvent(this);
			return 0;
		}

		virtual void setImage(IplImage* image)
		{

			currentImage_ = image;
		}

		IplImage* getImage()
		{
			return currentImage_;
		}
		//we can exec some command for pannel
		virtual void exec(std::string cmd)
		{

		}

		QDockWidget* getDockWidget()
		{
			return dock_;
		}
		//tell the pannel some context information, for example,pannel can have many operatoration, 
		//when switching, tell this panel to update it's content according Context;
		void setContext(std::string Context)
		{
			strContext_ = Context;
		}

		QMenu *menu;
	//	void setCustomSizeHint(const QSize &size);
	//private:
	//	void allow(Qt::DockWidgetArea area, bool allow);
	//	void place(Qt::DockWidgetArea area, bool place);
	//protected:
	//	virtual void contextMenuEvent(QContextMenuEvent *event);
	//	virtual void resizeEvent(QResizeEvent *e);

	public slots:
			virtual void OnEvent(void* pParam,void* Sender)
			{
			
			}
	protected:
		IplImage* currentImage_;
		std::string strContext_;
		QDockWidget* dock_;
	};
}